﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace ImbedLibrary
{
    internal class Win32API
    {
        [DllImport("netapi32.dll", EntryPoint = "NetApiBufferFree")]
        internal static extern void NetApiBufferFree(IntPtr bufptr);

        [DllImport("netapi32.dll", EntryPoint = "NetLocalGroupGetMembers")]
        internal static extern uint NetLocalGroupGetMembers(IntPtr serverName, IntPtr grouprName, uint level, ref IntPtr siPtr, uint prefmaxlen, ref uint entriesread, ref uint totalentries, IntPtr resumeHandle);

        [DllImport("netapi32.dll", EntryPoint = "NetLocalGroupEnum")]
        internal static extern uint NetLocalGroupEnum(IntPtr serverName, uint level, ref IntPtr siPtr, uint prefmaxlen, ref uint entriesread, ref uint totalentries, IntPtr resumeHandle);

        [StructLayoutAttribute(LayoutKind.Sequential,CharSet=CharSet.Auto)]
        internal struct LOCALGROUP_MEMBERS_INFO_1
        {
            public IntPtr lgrmi1_sid;
            public IntPtr lgrmi1_sidusage;
            public IntPtr lgrmi1_name;
        }

        [StructLayoutAttribute(LayoutKind.Sequential,CharSet=CharSet.Auto)]
        internal struct LOCALGROUP_INFO_1
        {
            public IntPtr lpszGroupName;
            public IntPtr lpszComment;
        }
    }
}
